/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package elevatronic.utils;

import elevatronic.view.MainFrame;
import elevatronic.view.simulation.FloorView;
import pl.gdan.elsy.tool.Rand;

/**
 *
 * @author Exosta
 */
public class Utils {
    public enum Direction {
        ASCENDING(1),
        DESCENDING(-1),
        STOPPING(0);
        
        private int value;
        
        Direction(int value) {
            this.value = value;
        }
    }
    
    /**
     * Does a random without a value
     * @param from
     * @param to
     * @param ignoredValue
     * @return 
     */
    public static int RandomWithoutAValue(int from, int to, int ignoredValue) {
        if (Rand.b() || to == ignoredValue || from == ignoredValue) {
            return Rand.i(from, ignoredValue - 1);
        }
        else
            return Rand.i(ignoredValue + 1, to);
    }
    
    /**
     * getPosX allow to convert floor position to pixel on screen
     * @param floorPosition
     * @param imageHght
     * @return
     */
    public static int GetPosY(double floorPosition,double imageHght){
    	return (int)(MainFrame.HEIGHT-(FloorView.FIRST_FLOOR_POS_Y+(floorPosition*FloorView.SEPARATION_BETWEEN_TWO_FLOORS)+imageHght));    	
    }
}
